package com.project.service;

import com.alibaba.fastjson.JSONObject;
import com.project.dao.AreaMapper;
import com.project.entity.Area;
import com.project.service.base.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional(rollbackFor = {Exception.class})
@Service
public class AreaServiceImpl extends BaseService implements AreaService{

    @Autowired
    private  AreaMapper areaMapper;

    @Override
    public int addOne(Area area){
        return areaMapper.insertSelective(area);
    }

    @Override
    public int removeOneById(Integer id){
        return areaMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int modifyOneById(Area area){
        return areaMapper.updateByPrimaryKeySelective(area);
    }

    @Override
    public Area findOneById(Integer id) {
        return areaMapper.selectByPrimaryKey(id);
    }

    @Override
    public JSONObject findOneDetailById(Integer id) {
        return areaMapper.selectOneDetailById(id);
    }

}
